<template>
    <div :id="qId"></div>
</template>
<script>

import QRCode from 'qrcodejs2'  // 引入qrcode
export default {
    props:["data","id",'widths'],
    data(){
        return{
            qId:"",
            pId:"",
            cId:"",
            width:""
        }
    },
    created(){
        this.width=this.widths.replace("width:","").replace("px","")
        let time=new Date().getTime();
        let ids=this.id.split(".");
        this.pId=ids[0];
        this.cId=ids[1];
        this.qId=this.cId+time;
        
    },
    mounted(){
        let qrcode = new QRCode(this.qId, {
            width: this.width,  
            height: this.width,
            text: this.data[this.pId][this.cId], // 二维码地址
        })
    }
}
</script>